package com.loveprogrammer.eternity.factory;

import com.loveprogrammer.eternity.action.BaseAction;
import com.loveprogrammer.eternity.enums.QualityEnum;
import com.loveprogrammer.eternity.model.product.Equipment;
import com.loveprogrammer.eternity.model.product.Goods;
import com.loveprogrammer.eternity.model.product.Things;
import com.loveprogrammer.eternity.model.product.eggs.Egg;
import com.loveprogrammer.eternity.model.product.equipment.Weapon;

import java.util.Random;

/**
 * @version 1.0.0
 * @description:
 * @author: eric
 * @date: 2023-01-18 16:45
 **/
public class GoodsFactory {

    public static Goods getGoodsById(String type,int id,QualityEnum qualityEnum){
        if(qualityEnum == null){
            QualityEnum.getById(new Random().nextInt(6));
        }
        switch (type){
            case "weapon":
                return getWeapon(id,qualityEnum);
            case "equipment":
                return getEquipment(id,qualityEnum);
            case "special":
                return getSpecial(id,QualityEnum.暗金);
            case "egg":
                return getEgg(id,qualityEnum);
            case "thing":
                return getThings(id,qualityEnum);
            default:
                return null;
        }
    }

    private static Equipment getSpecial(int id, QualityEnum qualityEnum) {
        return EquipmentFactory.getSpecialById(id,qualityEnum);
    }


    public static Weapon getWeapon(int id, QualityEnum qualityEnum){
       return EquipmentFactory.getWeaponById(id,qualityEnum);
    }
    public static Equipment getEquipment(int id, QualityEnum qualityEnum){
        return EquipmentFactory.getEquipmentById(id,qualityEnum);
    }
    public static Things getThings(int id, QualityEnum qualityEnum){
        return ThingsFactory.getThingsById(id,qualityEnum);
    }
    public static Egg getEgg(int id, QualityEnum qualityEnum){
        return EggFactory.getEgg(id,qualityEnum);
    }

}
